package net.chenlin.dp.modules.base.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import net.chenlin.dp.modules.base.entity.SysCarEntity;
import net.chenlin.dp.modules.base.manager.SysCarManager;
import net.chenlin.dp.modules.base.service.SysCarService;

/**
 * 车入库
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年12月03日 下午9:17:36
 */
@Service("sysCarService")
public class SysCarServiceImpl implements SysCarService {

	@Autowired
	private SysCarManager sysCarManager;

	@Override
	public Page<SysCarEntity> listSysCar(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SysCarEntity> page = new Page<>(query);
		sysCarManager.listSysCar(page, query);
		return page;
	}

	@Override
	public R saveSysCar(SysCarEntity role) {
		int count = sysCarManager.saveSysCar(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getSysCarById(Long id) {
		SysCarEntity sysCar = sysCarManager.getSysCarById(id);
		return CommonUtils.msg(sysCar);
	}

	@Override
	public R updateSysCar(SysCarEntity sysCar) {
		int count = sysCarManager.updateSysCar(sysCar);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = sysCarManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
